GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 4076af...0f1b06 )
by Benjamin
01:31
created

handleEditClick.js ➔ ???   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
cc 3
c 3
b 1
f 1
nc 2
dl 0
loc 17
rs 9.4285
nop 8

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
import { editRow } from './../actions/plugins/editor/EditorActions';
2
3
export const handleEditClick = (
4
    editor,
5
    store,
6
    rowId,
7
    rowData,
8
    rowIndex,
9
    columns,
10
    stateKey,
11
    events = {},
12
    data,
13
) => {
14
15
    if (events.HANDLE_BEFORE_EDIT) {
16
        const result = events.HANDLE_BEFORE_EDIT({
17
            store,
18
            id: rowId,
19
            data: rowData
20
        });
21
22
        // if HANDLE_BEFORE_EDIT event returns false
23
        // do not trigger edit
24
        if (result === false) {
25
            return;
26
        }
27
    }
28
29
    const row = closestRow(data.reactEvent.target);
30
    const offset = 7;
31
    const top = row ?
32
        (row.offsetTop + row.clientHeight + offset)
33
        : 0;
34
35
    if (editor.config.type === editor.editModes.inline) {
36
        store.dispatch(
37
            editRow({
38
                rowId, top, rowData, rowIndex, columns, stateKey
39
            })
40
        );
41
    }
42
};
43
44
export const closestRow = (target) => {
45
    let el = target;
46
47
    while (el && el !== document.body) {
48
        if (el && el.classList && el.classList.contains('react-grid-row')) {
49
            return el;
50
        }
51
        el = el.parentNode;
52
    }
53
};
54